#include <algorithm>
#include <iterator>
#include <vector>

class Solution {
 public:
  std::vector<int> searchRange(std::vector<int>& nums, int target)
  {
    auto iter = std::find(nums.begin(), nums.end(), target);
    if (iter == nums.end()) { return {-1, -1}; }

    int first = std::distance(nums.begin(), iter);
    while (iter != nums.end() && *iter == target) { ++iter; }
    int second = std::distance(nums.begin(), iter);

    return {first, second - 1};
  }
};
